<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
    <div class='layui-form-item'>
        <label class='layui-form-label'>新密码</label>
        <div class='layui-input-inline'>
            <input type='password' name='newPass' id="newPass" lay-verify='required|pass' lay-verType="tips" placeholder='请输入密码' autocomplete='off' class='layui-input'>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>确认密码</label>
        <div class='layui-input-inline'>
            <input type='password' name='newPass2' id="newPass2" lay-verify='required|repass' lay-verType="tips" placeholder='请再次输入密码' autocomplete='off' class='layui-input'>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" value="确认" class="layui-btn">
        </div>
    </div>
</div>

<script type="text/javascript">

    layui.use(['form'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
        var $ = layui.$;

        form.verify({
            pass: function (value, item) { //value：表单的值、item：表单的DOM对象
                if (value.length < 8) {
                    return "密码不得低于8位";
                }
                if (value.length > 16) {
                    return "密码不得大于16位";
                }
                if (value.indexOf(' ') >= 0) {
                    return "密码不能包含空格";
                }
                if (!new RegExp(/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,}$/).test(value)) {
                    return '密码须包含字母+数字';
                }
            },
            repass: function (value) {
                if (value != $('#newPass').val()) {
                    return '两次密码输入不一致';
                }
            }
        });

    });


</script>
